package com.easyj.admin.sys.service;


import com.easyj.base.common.page.Page;
import com.easyj.base.exception.EasyjException;
import com.easyj.base.security.UserAuthorities;

import java.util.Date;
import java.util.List;

import org.springframework.web.multipart.MultipartFile;

import com.easyj.admin.db.model.Group;
import com.easyj.admin.db.model.ImpResult;
import com.easyj.admin.db.model.Position;
import com.easyj.admin.db.model.Role;
import com.easyj.admin.db.model.User;
import com.easyj.admin.db.model.UserQO;

public interface UserService {
	
	
	public List<User> searchUser(String filter);
	
	public List<User> findList(UserQO filter);
	
	public long count(UserQO filter);
	
	public Page<User> findPage(UserQO filter);
		
	public User findById(Long id);
	
	public List<User> findAll();
	/**
	 * 从cache 取得user
	 * @param userId
	 * @return
	 */
	public User findByCache(Long id);
	
	public int  insertEntity(User entity) throws EasyjException;
	public int  updateEntity(User entity) throws EasyjException;

    public int  disableById(Long id) throws EasyjException;
	public int  enableById(Long id) throws EasyjException;
	
	public int  leaveById(Long id)throws EasyjException;

	public User  findByLoginName(String loginName);
	
	//public User  selectUniqueByUqName(String name);
	
	public List<Role> findRolesByUserId(Long userId);
	
	public List<Position> findPositionsByUserId(Long userId);
	
	public List<Group> findGroupsByUserId(Long userId);
	
	/**
	 * 
	 * @param loginInfo User Object only has login Info
	 * @return
	 */
	public int saveLoginInfo(User loginInfo);
	/**
	 * 取得用户权限，cacheable
	 * @param id
	 * @return
	 */
	public UserAuthorities getUserAuthoritiesByCache(Long id,Long deptId);
	
	 /*取得用户权限
	  * 
	  */
	public UserAuthorities getUserAuthorities(Long id,Long deptId);
	
	
	public int changePassword(User uerInfo);
	/**
	 * 用户更新自己的个人信息
	 * @param persioninfo
	 * @return
	 */
	public int updatePersonInfo(User entity);
	
	public int updateAvatar(User entity);
	
	/**
	     *       自动解锁
	* @param loginTime
	* @return
	*/
    public int unLockedUserAuto(Date loginTime);

	
	public int  unLockedUserById(Long id);
	
	public int  lockedUserById(Long id);
	
	public ImpResult importExcel(MultipartFile excelfile,Long operatorId) throws Exception;
	
	
}
